#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int num(int aa)
{
	if (aa < 9)
	{
		return aa;
	}
	return aa % 10 + num(aa / 10);
}

int arr1[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
int arr2[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };

int  main()
{
	int i = 1900;
	int count = 0;
	while (i <= 9999)
	{
		int n = num(i);
		int c = 1;
		while (c < 13)
		{
			if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0)
			{
				for (int d = 1; d <= arr2[c]; d++)
				{
					if (n == num(d) + num(c))
						count++;
				}
			}
			else for (int d = 1; d <= arr1[c]; d++)
					{
						if (n == num(d) + num(c))
							count++;
					}
				
			c++;
		}
		i++;
	}
	
		
	printf("%d", count);

}